package goldeneagle.com.admin.service;

import goldeneagle.com.admin.dao.impl.AdminManagerDaoImpl;
import goldeneagle.com.entity.Product;

import java.util.List;

public class AdminManagerService {
    AdminManagerDaoImpl adminManagerDao =new AdminManagerDaoImpl();
    public List adminSelectProductList(int currentPage, int size){
        System.out.println("调用了adminSelectProductList Service");
        return adminManagerDao.adminSelectProductList(currentPage,size);
    }



    public long totalCount(String name){
        return adminManagerDao.totalCount(name);
    }

    public boolean adminAddProduct(Product product) {
        return adminManagerDao.adminAddProduct(product);
    }
    public boolean adminUpadteProduct(Product product){
        return adminManagerDao.adminUpdateProduct(product);
    }

    public Product findProductById(int id){
        return adminManagerDao.findProductById(id);
    }

    public boolean adminDeleteProduct(int id){
        Product p = adminManagerDao.findProductById(id);
        return  adminManagerDao.adminDeleteProduct(p);
    }
}
